<template>
  <div>
    <div>
      <el-row :gutter="20">
        <el-col :span="6">
          <div class="model-header">组织机构</div>
        </el-col>
        <el-col :span="18">
          <div class="model-header">发送传真</div>
        </el-col>
      </el-row>
    </div>

    <!-- 树形控件 -->
    <div style="margin-top: 20px">
      <el-row :gutter="20">
        <el-col :span="6">
          <!-- <el-form size="small" :inline="true" label-width="48px">
            <el-form-item>
              <el-input />
            </el-form-item>
            <el-form-item>
              <el-button type="primary" icon="el-icon-search" size="mini"
                >搜索</el-button
              >
              <el-button icon="el-icon-refresh" size="mini">清除</el-button>
            </el-form-item>
          </el-form> -->
          <div class="tree">
            <el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
          </div>
        </el-col>
        <el-col :span="18">
          <div class="list">发送列表</div>
          <div class="fax">
            <!-- <FaxtableVue /> -->
          </div>
          <div class="but">
            <el-button type="primary" size="mini">发送传真</el-button>
          </div>
        </el-col>
      </el-row>
    </div>
    <div class="model-header">传真记录</div>
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="50px">
      <el-form-item label="号码:" prop="cnname">
        <el-input v-model="queryParams.cnname" placeholder="请输入号码" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="时间:" prop="optime">
        <el-date-picker clearable v-model="form.optime" type="date" value-format="yyyy-MM-dd" placeholder="请选班时间">
        </el-date-picker>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini">重置</el-button>
      </el-form-item>
    </el-form>
    <el-table :data="tableData" border style="width: 100%">
      <el-table-column prop="date" label="发送号码" width="350" align="center">
      </el-table-column>
      <el-table-column prop="name" label="部门/联系人" width="350" align="center">
      </el-table-column>
      <el-table-column prop="name" label="发送时间" width="350" align="center">
      </el-table-column>
      <el-table-column prop="address" label="发送内容" align="center">
        <template>
          <el-button type="text">下载</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getUsers" />
  </div>
</template>
<script>
import { treeselect } from "@/api/system/dept";
import { listUser } from "@/api/guard/addressbook";

export default {
  components: {},
  name: "GuardJoinReport",
  data() {
    return {
      data: [],
      defaultProps: {
        children: "children",
        label: "deptName",
      },
      //分页
      currentPage4: 4,
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        planid: null,
        filename: null,
        attachcontent: null,
      },
      checkList: ["选中且禁用", "复选框 A"],
      tableData: [
        {
          date: "025-26584596",
          name: "许奇思",
          address: "2022年8月11日 18:26:33",
        },
      ],
      labelPosition: "left",
      title: "",
      form: {
        name: "",
        region: "",
        date1: "",
        date2: "",
        delivery: false,
        type: [],
        resource: "",
        desc: "",
      },
      open: false,
      currentPage4: 1,
      total: 0,
    };
  },
  mounted() {
    this.getDept();
  },
  methods: {
    getDept() {
      const that = this;
      treeselect().then((res) => {
        that.data = res.data;
      });
    },
    handleNodeClick(data) {
      this.userQueryForm.deptId = data.deptId;
      this.getUsers();
    },
    getUsers() {
      const that = this;
      listUser(this.userQueryForm).then((res) => {
        console.log(res);
        that.bookData = res.rows;
        that.total = res.total;
      });
    },
    newissue() {
      this.open = true;
    },
    cancel() {
      this.open = false;
    },
    onSubmit() { },
    handleDialogClose() { },

    handleChange() { },
    handleSizeChange() { },
    handleCurrentChange() { },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    },
  },
};
</script>
<style scoped>
.el-input__inner {
  width: 200px !important;
}

.model-header {
  height: 40px;
  line-height: 40px;
  color: #009dfa;
}

.row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}

.avatar {
  width: 80px;
  height: 80px;
}

.avatar img {
  width: inherit;
  height: inherit;
}

.info {
  flex: 1;
  display: flex;
  flex-flow: column;
  margin-left: 10px;
}

.name {
  flex: 1;
  font-size: 18px;
  border-bottom: 1px solid white;
  padding-bottom: 5px;
  color: white;
}

.name span {
  font-size: 13px;
  margin-left: 10px;
  color: grey;
}

.contact {
  height: 26px;
  line-height: 26px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  color: white;
}

.address-card /deep/ .el-card__body {
  display: flex;
  flex-flow: row;
}

.fax {
  height: 300px;
  border: 1px solid #ccc;
  overflow: auto;
}

.list {
  margin-bottom: 10px;
  background: rgb(0, 119, 255);
  padding: 5px;
}

.but {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.but .el-button--mini {
  font-size: 22px;
  width: 200px;
  height: 45px;
}
</style>
